package com.goblin.model.media.po;

import com.goblin.model.base.BaseEntity;
import com.goblin.model.uaa.po.User;
import lombok.Data;

import javax.persistence.*;

@Data
@Table(name = "t_test_meida_chat")
@Entity
public class Chat extends BaseEntity {

    @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.DETACH) //JPA注释： 一对一 关系
    @JoinColumn(name = "custom_A", referencedColumnName = "id", nullable = false, columnDefinition = " int(11) COMMENT '聊天人A'")
    private User customA;

    @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.DETACH) //JPA注释： 一对一 关系
    @JoinColumn(name = "custom_B", referencedColumnName = "id", nullable = false, columnDefinition = " int(11) COMMENT '聊天人B'")
    private User customB;

    @Column(name = "date", columnDefinition = "long COMMENT '发送时间戳'")
    private Long date;

    @Column(name = "online", columnDefinition = "tinyint(1) COMMENT '是否在线'")
    private Boolean online;
}
